﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZDSoft.LMS.Domain;
using NHibernate.Criterion;

namespace ZDSoft.LMS.Service
{
    public interface IUserService
    {
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="account">操作员输入的用户名</param>
        /// <param name="password">操作员输入的密码</param>
        /// <returns>当用户名和密码成功匹配时返回匹配的用户信息，否则返回null</returns>
        User Login(string account, string password);

       
        /// <summary>
        /// 根据查询条件分页获取数据
        /// </summary>
        /// <param name="queryConditions">查询条件</param>
        /// <param name="orderList">排序字段</param>
        /// <param name="pageIndex">当前页码，从1开始</param>
        /// <param name="pageSize">每页数据总数</param>
        /// <param name="count">满足查询条件的总数</param>
        /// <returns>满足查询条件的数据集合</returns>
        IList<User> GetPaged(IList<ICriterion> queryConditions, IList<Order> orderList, int pageIndex, int pageSize, out int count);

        /// <summary>
        /// 根据ID获取User实体
        /// </summary>
        /// <param name="id">ID</param>
        /// <returns>ID为id的实体</returns>
        User Get(int id);

        /// <summary>
        /// 修改传入的User实体
        /// </summary>
        /// <param name="user">要修改的User实体</param>
        void Update(User user);

        /// <summary>
        /// 创建用户实体
        /// </summary>
        /// <param name="user">要创建的user实体</param>
        void Create(User user);

        /// <summary>
        /// 创建用户实体
        /// </summary>
        /// <param name="user">要创建的user实体</param>
        /// <param name="rolesId">用,隔开的多个角色ID</param>
        void Create(User user,string rolesId);

        /// <summary>
        /// 根据id删除实体
        /// </summary>
        /// <param name="id">要删除对象的id</param>
        void SwitchStatus(int id);


        /// <summary>
        /// 帐号重复性检测
        /// </summary>
        /// <param name="id">帐号对应的ID值</param>
        /// <param name="account">要判断的帐号名</param>
        /// <returns></returns>
        bool AccountCheck(int? id ,string account);

        /// <summary>
        /// 修改用户实体
        /// </summary>
        /// <param name="userId">要修改的userID</param>
        /// <param name="rolesId">用,隔开的多个角色ID</param>
        void AssignRole(int userId, string rolesId);

        #region hql测试,create by lengyahong
        void CreateTest(User user);
        void UpdateTest(User user);
        void DeleteTest(User user);
        User GetTest(int id);
        int CountTest(string userName);
        #endregion
    }
}
